package com.hist.medical_treatment.dao;

import java.util.Date;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.hist.medical_treatment.entity.Register;

@Mapper
public interface RegisterDao {
	 @Select("select register.ID,CaseNumber,RealName,Gender,ConstantName,BirthDate,Age,AgeType,visitDate,Noon,DeptID,department.DeptName,UserID,RegistLeID,registlevel.RegistName,SettleID,IsBook,RegistTime,RegisterID,VisitState from register,constantitem,department,registlevel where register.CaseNumber=#{caseNumber} and register.Gender=constantitem.ID and register.DeptID=department.ID and register.RegistLeID=registlevel.ID")
	 Register getRegisterByCaseNumber(String caseNumber);
	 @Select("select CaseNumber from register where ID=(select max(ID) from register)")
     String nextRegister();
	 @Insert("insert into register(id,caseNumber,realName,Gender,BirthDate,age,ageType,visitDate,noon,deptID,userID,registLeID,settleID,registTime,registerID) values(#{id},#{caseNumber},#{realName},#{gender},#{birthDate},#{age},#{ageType},#{visitDate},#{noon},#{deptID},#{userID},#{registLeID},#{settleID},registTime,#{registerID})")
	 void insertRegister(Integer id,String caseNumber,String realName,Integer gender,Date birthDate,Integer age,String ageType,Date visitDate,String noon,Integer deptID,Integer userID,Integer registLeID,Integer settleID,Integer registerID);
	 @Select("select max(id) from register")
	 Integer getMaxID();
}
